package com.example.mapstructtest.converter;

import com.example.mapstructtest.model.UserModel;
import com.example.mapstructtest.vo.UserVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @author dangwen1
 * @date 2021年12月03日 11:23
 * @description
 */
@Mapper
public interface UserModelConverter extends BaseMapping<UserModel, UserVO> {
    UserModelConverter INSTANCE = Mappers.getMapper(UserModelConverter.class);

    @Mappings({
            @Mapping(source = "birthday", target = "birthday", dateFormat = "yyyy-MM-dd"), // format好像没什么用
            @Mapping(source = "age", target = "age", ignore = true)
    })
    @Override
    UserVO sourceToTarget(UserModel var1);
}
